$('#sceneopen').on('mouseenter', sceneShow);
$('#sceneopen').on('mouseleave', sceneDrop);
$('#sceneopen').on('click', sceneOpen);
$('#sceneopen_2').on('mouseenter', sceneShow_2);
$('#sceneopen_2').on('mouseleave', sceneDrop_2);
// $('#sceneopen_2').on('click', sceneOpen_2)
let host =window.location.protocol+'//'+ window.location.host +'/qhszpm';

//[前海中级城市模型] 应用场景 - [前海控股大厦21层] 室内模型出现
function sceneShow_2(){
    var ids = get_arr(0, 2000);
    //图层根据部件id偏移
    var layerNew = viewer.scene.layers.find("前海控股大厦@二单元建筑");
    layerNew.style3D.fillForeColor.alpha = 0.5;
    layer_floor_QHKG.selectedTranslate = new Cesium.Cartesian3(-12,-8,50);
    layer_floor_QHKG.visible = true;
    layer_floor_QHKG.setObjsOffset(ids);
};

//[前海中级城市模型] 应用场景 - [前海控股大厦21层] 室内模型收回
function sceneDrop_2(){
    var ids = get_arr(0, 2000);
    //图层根据部件id偏移
    var layerNew = viewer.scene.layers.find("前海控股大厦@二单元建筑");
    layerNew.style3D.fillForeColor.alpha = 1;
    layer_floor_QHKG.visible = false;
};

//[前海中级城市模型] 应用场景 - 室内模型出现
function sceneShow(){
    var ids = get_arr(0, 2000);
    //选择图层
    var layer_lower = viewer.scene.layers.find("F0@听海大道地下空间20201016#1");
    var layer_upper = viewer.scene.layers.find("F1@听海大道地下空间20201016");
    //图层根据部件id偏移
    layer_lower.selectedTranslate = new Cesium.Cartesian3(0,0, 60);
    layer_lower.setObjsOffset(ids);
    layer_upper.selectedTranslate = new Cesium.Cartesian3(0,0, 60);
    layer_upper.setObjsOffset(ids);
};


//[前海中级城市模型] 应用场景 - 室内模型收回
function sceneDrop(){
    var ids = get_arr(0, 2000);
    //选择图层
    var layer_lower = viewer.scene.layers.find("F0@听海大道地下空间20201016#1");
    var layer_upper = viewer.scene.layers.find("F1@听海大道地下空间20201016");
    //图层根据部件id偏移
    layer_lower.selectedTranslate = new Cesium.Cartesian3(0,0, -20);
    layer_lower.setObjsOffset(ids);
    layer_upper.selectedTranslate = new Cesium.Cartesian3(0,0, -20);
    layer_upper.setObjsOffset(ids);
};


//进入 [听海大道地下室内模型] 应用场景
function sceneOpen(){

//清除 outdoor.js 自动切入效果 
    // clearTimeout(startTimeId);

//隐藏
//-- 中型城市模型应用界面 
    $('#sceneopen').addClass('hide');
    $('#sceneopen_2').addClass('hide');
    $('#sceneopen_3').addClass('hide');
    $('#sceneopen_4').addClass('hide');


//打开
//-- 室内模型应用界面
    setTimeout(function(){    
        $('#firestart').removeClass('hide');
        $('#escape').removeClass('hide');
        // $('#pathplanning').removeClass('hide');
        $('#floorclose').removeClass('hide');
        $('#startfly').removeClass('hide');
    },3500)


//[听海大道地下室内模型] 浮现
    var ids = get_arr(0, 2000);
    var offsetZ1 = 0;
    var layer_lower = viewer.scene.layers.find("F0@听海大道地下空间20201016#1");
    var layer_upper = viewer.scene.layers.find("F1@听海大道地下空间20201016");

//进入初始视角 
    originSpot();

    setTimeout(function(){
//浮现动画效果
        var pTime = 0;
        var newStartTimeId = setInterval(function(){
            if (pTime == 120){
                clearInterval(newStartTimeId);
            }
            layer_lower.selectedTranslate = new Cesium.Cartesian3(0,0, -20 + offsetZ1/1.5);
            layer_lower.setObjsOffset(ids);
            layer_upper.selectedTranslate = new Cesium.Cartesian3(0,0, -20 + offsetZ1);
            layer_upper.setObjsOffset(ids);
            offsetZ1 += 1;
            pTime++;
        }, 1);
    }, 1500);
};
function backtosandbox (){
	console.log(host)
	let tosandbox = confirm("返回数字沙盘")
    if (tosandbox) {
        window.location = host + '/pmui/qhsz/index.html';
    }
}